| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkGraphics::TextureManager Class Referencefinal

Manages the textures available in the component. More...

Inheritance diagram for nkGraphics::TextureManager:

## Public Member Functions
| ~TextureManager ()
Texture * | createOrRetrieve (const nkMemory::StringView &name)
Texture * | get (const nkMemory::StringView &name)
Texture * | getByIndex (unsigned int id)
void | rename (const nkMemory::StringView &currentName, const nkMemory::StringView &newName)
void | erase (const nkMemory::StringView &name)
void | setActiveRenderTarget (Texture *target)
void | setActiveDepthTarget (Texture *target)
Texture * | getActiveRenderTarget () const
Texture * | getDepthTarget () const

## Detailed Description

Manages the textures available in the component.

At all times, manager owns any memory allocated inside. External code should never delete memory returned by it.

## Constructor & Destructor Documentation

## ◆ ~TextureManager()

nkGraphics::TextureManager::~TextureManager | ( |  | ) |

Destructor.

## Member Function Documentation

## ◆ createOrRetrieve()

Texture* nkGraphics::TextureManager::createOrRetrieve | ( | const nkMemory::StringView & | name | ) |

Creates if unavailable, or retrieves if available, a texture.

Parameters

  name | The name of the texture to retrieve.

Returns
  The texture requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase().

## ◆ get()

Texture* nkGraphics::TextureManager::get | ( | const nkMemory::StringView & | name | ) |

Retrieves a texture.

Parameters

  name | The name of the texture to retrieve.

Returns
  The texture requested if available, nullptr else.

## ◆ getByIndex()

Texture* nkGraphics::TextureManager::getByIndex | ( | unsigned int | id | ) |

Get a texture, by index. Note that one index can map to a different texture after memory is changed. Useful to loop over all available textures in one go.

Parameters

  id | The index of the texture to retrieve.

Returns
  The texture linked if available, nullptr else.

## ◆ rename()

void nkGraphics::TextureManager::rename | ( | const nkMemory::StringView & | currentName,
|  | const nkMemory::StringView & | newName
| ) |  |

Renames a texture.

Parameters

  currentName | The name of the texture to rename.
  newName | The name to reassign to the texture.

## ◆ erase()

void nkGraphics::TextureManager::erase | ( | const nkMemory::StringView & | name | ) |

Erases and frees a texture.

Parameters

  name | The name of the texture to erase.

## ◆ setActiveRenderTarget()

void nkGraphics::TextureManager::setActiveRenderTarget | ( | Texture * | target | ) |

Sets the active render target. Used during rendering to feed data to the shaders, for instance.

Parameters

  target | The target to flag as active.

## ◆ setActiveDepthTarget()

void nkGraphics::TextureManager::setActiveDepthTarget | ( | Texture * | target | ) |

Sets the active depth render target. Used during rendering to feed data to the shaders, for instance.

Parameters

  target | The target to flag as active.

## ◆ getActiveRenderTarget()

Texture* nkGraphics::TextureManager::getActiveRenderTarget | ( |  | ) | const

Returns
  The active render target.

## ◆ getDepthTarget()

Texture* nkGraphics::TextureManager::getDepthTarget | ( |  | ) | const

Returns
  the active depth target.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsGraphics/Textures/TextureManager.h